<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>

<sql:setDataSource 
	driver="com.mysql.jdbc.Driver" 
	user="jstu"
	password="abc123"
	url="jdbc:mysql://j.snpy.org/j102?charachterEncoding=UTF-8"
	var="ds" scope="page" />

<sql:query var="ds" dataSource="${ds }"
	sql="select * from guestbook">
<%-- 	sql="select * from guestbook where userid=?<sql:param>${param.userid}</sql:param>"> --%>
</sql:query>
<form action="">
	<input type="text" name="userid">
	<input type="submit" value="SEARCH">


</form>

<table border="1">

<c:forEach var="p" items="${ds.rows }">
	<TR>
		<TD>${p.id }</TD>
		<TD>${p.userid }</TD>
		<TD>${p.nickname }</TD>
		<TD>${p.title }</TD>
		<TD><a href="delete_post.jsp?id=${p.id }">刪除</a></TD>
	</TR>
</c:forEach>
</table>

</body>
</html>